﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using DAL;
using Utility;

namespace BUS
{
    public class Tbl_LoaiTK_BUS
    {
        public static Tbl_LoaiTK_Collection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            Tbl_LoaiTK_DAL loaitkDAL = new Tbl_LoaiTK_DAL();
            return loaitkDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static Tbl_LoaiTK_Collection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            Tbl_LoaiTK_DAL loaitkDAL = new Tbl_LoaiTK_DAL();
            return loaitkDAL.Get(cri.Criter, 0, 0, Tbl_LoaiTK_Columns.STT.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static Tbl_LoaiTK_Entities GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, Tbl_LoaiTK_Columns.STT.ToString(), Condition.EQUAL, iD);
            Tbl_LoaiTK_DAL loaitkDAL = new Tbl_LoaiTK_DAL();
            Tbl_LoaiTK_Collection loaitkCollection = loaitkDAL.Get(cri.Criter, 0, 0, Tbl_LoaiTK_Columns.STT.ToString(), OrderDirection.ASC.ToString(), out total);
            if (loaitkCollection.Count > 0)
                return loaitkCollection[0];
            return null;
        }

        public static void Insert(Tbl_LoaiTK_Entities loaitk)
        {
            Tbl_LoaiTK_DAL loaitkDAL = new Tbl_LoaiTK_DAL();
            loaitkDAL.Insert(loaitk);
        }
        public static void Update(Tbl_LoaiTK_Entities loaitk)
        {
            Tbl_LoaiTK_DAL loaitkDAL = new Tbl_LoaiTK_DAL();
            loaitkDAL.Update(loaitk);
        }
        public static void Delete(int id)
        {
            Tbl_LoaiTK_DAL loaitkDAL = new Tbl_LoaiTK_DAL();
            loaitkDAL.Delete(id);
        }
    }
}
